<?php
$path=Router::url(array('controller' => '/', 'action' =>''), true);
$cuser=$session->read('User');
$cgrouplist=$session->read('grouplist');
$userid=base64_encode($cuser["id"]);
$controller = $this->name; 
$actions = $this->action; 
$objmenu=$action->getnavigation($controller,$actions);
if(!$cuser['isadmin']){
	unset($objmenu['codetypes']);
	unset($objmenu['company']);
	if(!empty($objmenu['talstack'])){
		unset($objmenu['talstack']);
	}else{
	 unset($objmenu['talentsdecl']);
	}
}
if((!$cuser["isadmin"]&&!$cuser["can_updata"])){
	 unset($objmenu['updatecompany']);
}
if($cuser["can_updata"]&&$cuser["isvisitor"]){
	unset($objmenu['codetypes']);
	unset($objmenu['company']);
	unset($objmenu['users']);
	unset($objmenu['groups']);
	unset($objmenu['notices']);
}


$listpage=array("Users","Searchs","Reports","Types","Projects");//Usersforcommen
//cid是企业编号cgid是高校编号

if((@$cuser['cid'] || @$cuser['cgid']) && in_array($controller, $listpage)){
    //重定向浏览器   
    header("Location: ".$path);   
    //确保重定向后，后续代码不会被执行   
    exit; 
}


?> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="bookmark" type="image/x-icon" href="<?php echo $path;?>favicon.ico"/> 
<link rel="shortcut icon" href="<?php echo $path;?>favicon.ico"/>
<link rel="icon" type="image/x-png" href="<?php echo $path;?>favicon.png"/>

<?php echo $html->charset('utf-8') ?>
<?php echo $html->css('common.css'); ?>
<?php echo $html->css('jquery-ui-1.8.18.custom.css'); ?>
<?php echo $html->css('jquery.jscrollpane.css'); ?>
<?php echo $html->css('uniform.default.css'); ?>
<?php echo $javascript->link('jquery.min.js');?>
<?php echo $javascript->link('My97DatePicker/WdatePicker.js');?>
<?php echo $javascript->link('jquery-ui-1.8.18.custom.min.js');?>
<?php echo $javascript->link('message.js');?>
<?php echo $javascript->link('jquery.mousewheel.js');?>
<?php echo $javascript->link('jquery.jscrollpane.min.js');?>
<?php echo $javascript->link('jquery.uniform.js');?>
<?php echo $javascript->link('check.js');?>
<?php echo $javascript->link('placeholder.js');?>
<?php echo $javascript->link('jquery.form.js');?>
<?php echo $javascript->link('common.js');?>

<script type="text/javascript">
    $(document).ready(function()
    {
        var scollSettings = {
            showArrows: false,
            autoReinitialise: true
        };
        var pane = $('.right_side_scollbar');
        pane.jScrollPane(scollSettings);
        var contentPane = pane.data('jsp').getContentPane();
        
        var leftPanel = $(".left_side_menu_panel");
        leftPanel.jScrollPane(scollSettings);
        var leftContentPanel = leftPanel.data('jsp').getContentPane();
        <?php if($this->action=="edittalent"){?>
            $(":file").uniform();
            $("#CompanyTalmenu").uniform();
            $("#CompTalentDeclarateStatus").uniform();
        <?php }else{?>
            $(":file, :checkbox, :radio, select").uniform();
        <?php }?>
        <?php if($this->name=="Searchs" && ($this->action=="talentdb" || $this->action=="index" || $this->action=="allfinace")){?>
            $("div.selector").css("width","120px");
            $("div.selector span").css("width","90px");
            $("div.selector select").css("min-width","126px");
            
        <?php }?>
        <?php if($this->name=="Projects" && $this->action=="index"){?>
            $("div.selector").css("width","130px");
            $("div.selector span").css("width","100px");
            $("div.selector select").css("min-width","136px");
        <?php }?>
    
        $(".left_side_menu_panel li li a[class='selected']").parent().parent().css("display","block");
        $(".left_side_menu_panel li li a[class='selected']").parent().parent().siblings().addClass("active");
        $(".left_side_menu_panel").find(".active").addClass("selected");
        if ($.browser.msie && ($.browser.version == "7.0")) {
            //$(".left_side_menu").css("margin-left","-270px");
           // $(".book_link").css("margin-left","-13px");
           // $(".list_user_name").css("margin-left","150px");
           // $(".admin_tag").css("margin-left","-190px");
         }
         else if ($.browser.msie && ($.browser.version == "6.0") && !$.support.style) {
             alert(2);
         }
    });

$(function(){
    var _wrap=$('ul.line');//定义滚动区域
    var _interval=3000;//定义滚动间隙时间
    var _moving;//需要清除的动画
    _wrap.hover(function(){
        clearInterval(_moving);//当鼠标在滚动区域中时,停止滚动
    },function(){
        _moving=setInterval(function(){
            var _field=_wrap.find('li:first');//此变量不可放置于函数起始处,li:first取值是变化的
            var _h=_field.height();//取得每次滚动高度(多行滚动情况下,此变量不可置于开始处,否则会有间隔时长延时)
            _field.animate({marginTop:-_h+'px'},600,function(){//通过取负margin值,隐藏第一行
                _field.css('marginTop',0).appendTo(_wrap);//隐藏后,将该行的margin值置零,并插入到最后,实现无缝滚动
            })
        },_interval)//滚动间隔时间取决于_interval
    }).trigger('mouseleave');//函数载入时,模拟执行mouseleave,即自动滚动
});

</script>
<!--[if lt IE 9]>
<?php echo $html->css('ie.css'); ?>
<?php echo $javascript->link('ie.js');?>
<?php echo $javascript->link('jquery.placeholder.js');?>
<![endif]-->
<title>
<?php 
if($cuser["isadmin"]){
	echo "常熟领军人才管理平台";
}else{
	echo "常熟".$cgrouplist[$cuser['groupid']]."管理平台";
}
?>
</title>
</head>
<body>
<?php echo $this->element('judgeexplorer');?>
<div style="display:none">
<?php echo $html->link("url","/",array("id"=>"getpath"))?>
<div id="gcontroller"><?php echo $controller; ?></div>
<div id="gaction"><?php echo $actions; ?></div>
</div>
<div class="whole_page">
        <!-- header -->
        <?php if(1==1){?>
        <div class="head_bg">
            <div class="head_content">
                <div class="h_c_left_bg left"></div>
                <div class="h_c_center_bg left">
                    <div class="logo_nav_area">
                        <div class="custp_logo left"><a href="<?php echo $path.'companys/index'; ?>"><?php if($cuser['isadmin']){echo $html->image('logo.png');}else{  echo $html->image('logo'.$cuser['groupid'].'.png');}?></a></div>
                        <div class="custp_site_info">
                            <div class="login_user_info">
                                <div class="left head_title">网上管理平台</div>
                                    <div class="left user_welcome">欢迎&nbsp;
                                        <span>
                                        <?php if($cuser['cid']==""&&($cuser['isadmin']||$cuser['isgroupadmin'])){
                                        	echo $html->link($cuser['name'],"/users/view/".$cuser['id']);
                                        }else{echo $cuser['name'];} ?>
                                        </span>
                                    </div>
                                <div id="addmessage" class="info_alert left"><?php $session->flash() ;?></div>
                                <div class="right user_welcome_logout">
                                    <div class="left top_menu_btn">
                                        <div class="left header_alert">
                                            <div class="h_alert_n">
                                                <a title="站内信" href="<?php echo $path."msgs/index";?>">
                                                    <div class="notification_icon left"></div>
                                                    <div id="p_m_alert_list" class="left">
                                                        <div id="p_m_l">
                                                            <div class="notification_num left" id="p_m_alert"></div>
                                                        </div>
                                                    </div>
                                                    <div class="clear"></div>
                                                </a>
                                            </div>
                                        </div>
                                        <div class="clear"></div>
                                    </div>
                                    <div class="left user_logout"><?php echo $html->link(__('Exit',true), '/users/logout');?></div>
                                </div>
                                <div class='right' id='demo'>
                                <div class="notice_icon"></div>
                                <ul class='line'>
                                     <?php foreach($notices as $notice):?>
                                    <li>
                                    	
                                    	<a  title="<?php echo $notice['Notice']['title'];?>" href='<?php echo $path.'notices/visit_view/'.$notice['Notice']['id']?>'>
                                    		<?php echo $str->sub_len($notice['Notice']['title'],15);?>
                                    	</a>
                                    </li>
                                   
                                    <?php endforeach;?>
                                    </ul>
                                </div>
                                <div class="clear"></div>
                            </div>
                            <?php echo $this->element('navigation',array('controller'=>$controller,'actions'=>$actions,'objmenu'=>$objmenu)) ?>
                        </div>
                    </div>
                </div>
                <div class="h_c_right_bg left"></div>
                <div class="clear"></div>
            </div>
        </div>
        <?php }?>
        <!-- content_operate -->
        <div class="app_content">
            <div class="app_panel">
                <div class="app_panel_pos_f">
                    <div class="app_panel_pos_s"> 
                        <div class="left"></div>
                        <div class="left_side_menu left">
                            <div class="left_side_menu_panel">
                                <ul>								
                                    <?php
                                        $projectid=$session->read('projectid');
                                        $companyid=$session->read('companyid');
                                        $colleageid=$session->read('colleageid');
                                        if($controller == 'Projects' && empty($projectid)){
                                             echo '<li class="selected">';
                                             echo $html->link('项目引进',"/projects/index/");
                                             echo '</li>';
                                        }elseif($controller == 'Companys' && empty($companyid)){
                                             echo '<li class="selected">';
                                             $companypath="/companys/index/";
                                             if($cuser['cid']){
                                                $companypath="/companys/showinfosummary/".$cuser['cid'];
                                             }							          
                                             echo $html->link('企业信息',$companypath);				            	 
                                             echo '</li>';
                                        }else if($controller == 'Colleages' && empty($colleageid)){
                                             echo '<li class="selected">';
                                             $colleagepath="/colleages/index/";
                                             if($cuser['cgid']){
                                                $colleagepath="/colleages/showcolleageinfo/".$cuser['cgid'];
                                             }							          
                                             echo $html->link('技术转移数据',$colleagepath);
                                             echo '</li>';
                                        }else if($controller == 'Msgs'){
                        echo '<li>12345</li>';
                    }
                    else{
                                            foreach($objmenu as $key=>$menu)
                                            {
                                                 $selected = "";
                                                 $flag=false;
                                                 if($key==$actions){
                                                    $selected = "selected";
                                                 }
                                                 if(!empty($menu["pagelist"])){
                                                     $objpage=$menu["pagelist"];
                                                     if(!empty($objpage)){
                                                         foreach($objpage as $pagename){
                                                            if($pagename==$actions){
                                                                $selected = "selected";
                                                            }
                                                         }
                                                     }
                                                 }
                                                 $cll=strtolower($controller);
                                                 $url='/'.$cll.'/'.$key;
                                                 if(!empty($menu["url"])){
                                                     $url=$menu["url"];
                                                 }
                                                 if($key=="index" && $cuser['cid']){
                                                    $url='/companys/showinfosummary/'.$cuser['cid'];
                                                 }
                                                 if($key=="index" && @$cuser['cgid']){
                                                    $url='/colleages/showcolleageinfo/'.$cuser['cgid'];
                                                 }
                                                 if(empty($cuser['cid'])&& $key=="changepwd"){
                                                    $flag=true;
                                                 }
                                                 if(!$flag){
                                                     $zi="";
                                                     if($key=="compreport"  ||$key=="editpage" || $key=="economic" || $key=="tal" || 
                                                        $key=="tech" || $key=="servicesummary" || $key=="demand" || $key=="lease" || $controller == 'Reports'){
                                                        $zi=$key;
                                                     }
                                                     if(($key=="index" || $key=="talentdb" || $key=="allfinace" || $key=="carrierin") && $controller == 'Searchs'){
                                                        $zi="persondb";
                                                     }
                                                     if($key=="allindustry"){
                                                        $zi="";
                                                     }
                                                     echo '<li>';
                                                     if($zi){
                                                        $suburl="javascript:void(0)";
                                                        if($zi=="persondb"){
                                                            $suburl=$url;
                                                            echo $html->link("<span></span>".$menu["str"],$suburl,array("class"=>$selected." submenuArrow",'escape' => false));
                                                        }else{
                                                            echo $html->link("<span></span>".$menu["str"],$suburl,array("class"=>$selected." submenuArrow","onclick"=>"click_drop_menu(this)",'escape' => false));
                                                        }
                                                        if($controller == 'Companys' || $key == "servicesummary"){
                                                            if(!empty($menu["submenu"])){
                                                                $objmenu=$menu["submenu"];
                                                                echo'<ul style="display:none;">';
                                                                foreach($objmenu as $key=>$menu)
                                                                {  
                                                                     $selected="";
                                                                     if($key==$actions){
                                                                        $selected = "selected";
                                                                     }
                                                                     if($actions == "protypereport"){
                                                                        $protype_url = $_SERVER["REQUEST_URI"];
                                                                        $protype_menu = explode("/",$key);
                                                                        $protype_url = explode("/",$protype_url);
                                                                        if(array_pop($protype_menu)==array_pop($protype_url)){
                                                                            $selected = "selected";
                                                                        }
                                                                     }
                                                                     $cll=strtolower($controller);
                                                                     $url='/'.$cll.'/'.$key;
                                                                     if(!empty($menu["pagelist"])){
                                                                         $objpage=$menu["pagelist"];
                                                                         if(!empty($objpage)){
                                                                             foreach($objpage as $pagename){
                                                                                if($pagename==$actions){
                                                                                    $selected = "selected";
                                                                                }
                                                                             }
                                                                         }
                                                                     }
                                                                     echo '<li>';
                                                                     echo $html->link($menu["str"],$url,array("class"=>$selected));
                                                                     echo '</li>';
                                                                }									                            		
                                                                echo'</ul>';
                                                            }
                                                        } 
                                                        if($controller == 'Reports' ){
                                                             if(!empty($menu["submenu"])){
                                                                $objmenu=$menu["submenu"];
                                                                echo'<ul style="display:none;">';
                                                                foreach($objmenu as $key=>$menu)
                                                                {  
                                                                     $selected="";
                                                                     if($key==$actions){
                                                                        $selected = "selected";
                                                                     }
                                                                     if($actions == "protypereport"){
                                                                        $protype_url = $_SERVER["REQUEST_URI"];
                                                                        $protype_menu = explode("/",$key);
                                                                        $protype_url = explode("/",$protype_url);
                                                                        if(array_pop($protype_menu)==array_pop($protype_url)){
                                                                            $selected = "selected";
                                                                        }
                                                                     }
                                                                     $cll=strtolower($controller);
                                                                     $url='/'.$cll.'/'.$key;
                                                                     if(!empty($menu["pagelist"])){
                                                                         $objpage=$menu["pagelist"];
                                                                         if(!empty($objpage)){
                                                                             foreach($objpage as $pagename){
                                                                                if($pagename==$actions){
                                                                                    $selected = "selected";
                                                                                }
                                                                             }
                                                                         }
                                                                     }
                                                                     echo '<li>';
                                                                     echo $html->link($menu["str"],$url,array("class"=>$selected));
                                                                     echo '</li>';
                                                                }									                            		
                                                                echo'</ul>';
                                                            }                                                        	
                                                        	
                                                        }
                                                        if($controller == 'Searchs' ){
                                                            if(empty($tech)){
                                                                $tech="";
                                                            }
                                                            if($key=="index"){	
                                                                classregistry::init('Techstack')->getMenu($html,$tech,$actions,$controller,"techfilter",1,"settechfilter");
                                                            }
                                                            if($key=="talentdb"){	
                                                                classregistry::init('Techstack')->getMenu($html,$tech,$actions,$controller,"talentfilter",2,"settalentfilter");
                                                            }
                                                            if($key=="allfinace"){	
                                                                classregistry::init('Techstack')->getMenu($html,$tech,$actions,$controller,"finacefilter",3,"setfinacefilter");
                                                            }
                                                            if($key=="carrierin"){
                                                                classregistry::init('Codetype')->getMenu($html,$actions);
                                                            }
                                                        }
                                                     }else{
                                                        $menustr=$menu["str"];
                                                        if($controller == 'Projects' && $key=="index" && $projectid){
                                                            $menustr="项目基本信息";
                                                            $url="/projects/showinfo/".$projectid;
                                                        }
                                                        if($controller == 'Companys' && $key=="index" && $companyid){
                                                            $menustr="企业信息汇总";
                                                            $url="/companys/showinfosummary/".$companyid;
                                                        }
                                                        if($controller == 'Colleages' && $key=="index" && $colleageid){
                                                            $menustr="高校基本信息";
                                                            $url="/colleages/showcolleageinfo/".$colleageid;
                                                        }
                                                        echo $html->link($menustr,$url,array("class"=>$selected));
                                                     }
                                                     echo '</li>';
                                                 }
                                            }
                                        }
                                    ?>
                                </ul>
                            </div>                                                        
                        </div>
                        <div class="book_link left"></div>
                        <div class="right_side_details">
                            <?php echo $content_for_layout; ?>
                        </div>
                        <div class="clear"></div>
                    </div>
                <div class="clear"></div>
                </div>
            </div>
        </div>      
    </div>
    <!-- footer -->
        <div class="footer_nav_bar">
            <div class="footer_c_area">
                <?php 
                //如果是企业
                    if($cuser['cid'] || @$cuser['cgid']){
                        echo $this->element('footer');
                    }else{
                ?>
                <ul>
                    <?php 
                    $pselected="";
                    $cselected="";
                    $sselected="";
                    $rselected="";
                    $gselected="";
                    $collselected = "";
                    if($controller == 'Projects'){ 
                        $pselected="selected";
                    }
                    else if($controller == 'Companys'){ 
                        $cselected="selected";
                    }else if($controller == 'Searchs'){ 
                        $sselected="selected";
                    }else if($controller == 'Reports'){ 
                        $rselected="selected";
                    }else if($controller == 'Colleages'){ 
                        $collselected="selected";
                    }else if($controller == 'Types' || $controller == 'Users' || $controller == 'Groups'){
                        $gselected="selected";
                    }
                    
                    $projectpath="/projects/index";
                    $companypath="/companys/index";
                    $searchpath="/searchs/index";
                    $reportpath="/reports/allindustry";
                    $colleagepath="/colleages/index";
                    $grouppath="/users/index";
                    $emptypath="javascript:void(0)";
                    if($cuser['cid'] || @$cuser['cgid']){
                        $projectpath=$emptypath;
                        $companypath=$emptypath;
                        $searchpath=$emptypath;
                        $grouppath=$emptypath;
                        $reportpath=$emptypath;
                        $colleagepath=$emptypath;
                        $cssnone="display";
                        $pselected=$sselected=
                        $rselected=$gselected=
                        $collselected=$cselected=$cssnone;
                    }
                    ?>
                    <?php 
                  //$flag=$action->checkPermissions($cuser,"add");
                    
                    if($cuser['cid']==''){?>
                    <!-- <li class="<?php echo $pselected?>"><?php echo $html->link('<span class="bottom_bar_item_intro_icon"></span><span class="bottom_icon_title">'.__("projects",true).'</span>',$projectpath,array('escape' => false))?></li> -->
                    <?php }?>
                    
                    <li class="<?php echo $cselected?>"><?php echo $html->link('<span class="bottom_bar_item_data_icon"></span><span class="bottom_icon_title">'.__("companys",true).'</span>',$companypath,array('escape' => false))?></li>
                    <li class="<?php echo $sselected?>"><?php echo $html->link('<span class="bottom_bar_item_screen_icon"></span><span class="bottom_icon_title">'.__("searchs",true).'</span>',$searchpath,array('escape' => false))?></li>
                    <li class="<?php echo $rselected?>"><?php echo $html->link('<span class="bottom_bar_report_center_icon"></span><span class="bottom_icon_title">'.__("reports",true).'</span>',$reportpath,array('escape' => false))?></li>
                    <li class="display"><?php echo $html->link('<span class="bottom_bar_tech_trans_icon"></span><span class="bottom_icon_title">'.__("colleages",true).'</span>',$colleagepath,array('escape' => false))?></li>
                    <?php if($cuser['cid']==''&&($cuser['isadmin']==1||$cuser['isgroupadmin']==1)){?>
 					<li class="<?php echo $gselected?>"><?php echo $html->link('<span class="bottom_bar_settings_icon"></span><span class="bottom_icon_title">'.__("users",true).'</span>',$grouppath,array('escape' => false))?></li>   
					<?php }else if($cuser["can_updata"]&&$cuser["isvisitor"]){?>
					<li class="<?php echo $gselected?>"><?php echo $html->link('<span class="bottom_bar_settings_icon"></span><span class="bottom_icon_title">'.__("users",true).'</span>',"/notices/updatecompany",array('escape' => false))?></li>
					<?php }	?>
                </ul>
                <div class="clear"></div>
                <?php }?>
            </div>
        </div>
</body>
</html>
<?php echo $javascript->link('app.js');?>
<script>
messagefadeout();
var webpath=$("#getpath").attr('href');
setInterval("showTime()", 5000);
function showTime(){
   // getdata();
}

function getdata(){
    var uid="<?php echo $cuser['id'];?>";
    var urlpath=webpath+'projects/prompt/'+uid+'?r='+Math.random();
    $.ajax({     	   
        url: urlpath, 
        success:function(data){
            if(data=="-"){
                location.href=webpath;
            }
            var array=data.split(",");
            var alt=array[0];
            if(alt>99){alt="99+";}
            if(alt!="0")
            {
                $("#p_m_alert").css('display','block');
                $("#p_m_alert").html(alt);
            }
            var msg=array[1];
            if(msg>99){msg="99+";}
            if(msg!="0")
            {
                $("#n_m_alert").css('display','block');
                $("#n_m_alert").html(msg);
            }
        }
    });
}

function tst(){
$("#n_m_alert").css('display','none');
} 
</script>